﻿using System.Runtime.InteropServices;

namespace Gmantis.Controls.DataGrid
{
    internal enum RelativePositionType
    {
        BeforeFirstFrozen,
        FirstFrozen,
        ScrollingArea,
        EmptyZone,
        LastFrozen,
        AfterLastFrozen
    }

    [StructLayout(LayoutKind.Sequential)]
    internal struct RelativePosition
    {
        private int _index;
        private RelativePositionType _type;
        private bool _isOverCell;
        public RelativePosition(RelativePositionType type)
        {
            this._index = -1;
            this._type = type;
            this._isOverCell = true;
        }

        public RelativePosition(RelativePositionType type, int index)
        {
            this._index = index;
            this._type = type;
            this._isOverCell = true;
        }

        public RelativePosition(RelativePositionType type, int index, bool isOverCell)
        {
            this._index = index;
            this._type = type;
            this._isOverCell = isOverCell;
        }

        public int Index
        {
            get
            {
                return this._index;
            }
        }
        public RelativePositionType Type
        {
            get
            {
                return this._type;
            }
        }
        public bool IsOverCell
        {
            get
            {
                return this._isOverCell;
            }
        }
        public override string ToString()
        {
            return (this.Type.ToString() + ((this.Index >= 0) ? string.Format(" Index {0}", this.Index) : ""));
        }
    }
}
